#ifndef __System_ArrayXFunctorComparer_H__
#define __System_ArrayXFunctorComparer_H__

///<summary>
/// FunctorComparer<T>
///</summary>
//+ requires: System_Comparison(T)
//+ requires: Collections_IComparer(T)
//+ requires: Collections_Comparer(T)
#define System_ArrayXFunctorComparer(T) bindT(System_ArrayXFunctorComparer,T)
#define Declare_System_ArrayXFunctorComparer(T, Ti) \
	internal classT(System_ArrayXFunctorComparer,T,System_Object,classInterface(Collections_IComparer(T)), \
		private Collections_Comparer(T) *_c; \
		private System_Comparison(T) _comparison; \
	); \
	Declare_CtorT(,public,System_ArrayXFunctorComparer,T, System_Comparison(T) comparison)
#define Implement_System_ArrayXFunctorComparer(T, Ti) \
	/*[ Compare ] */ \
	public int_ spaceT(System_ArrayXFunctorComparer,T,Compare)(System_ArrayXFunctorComparer(T) *t, Ti x, Ti y) \
	{ \
		return t->_comparison(x, y); \
	} \
	Implement_TypeT(System_ArrayXFunctorComparer,T,System_Object,typeInterface(Collections_IComparer(T)), \
		System_ObjectVector *vtable = t->Collections_IComparer(T).__vtable; \
		vtable[_Collections_IComparer_##T##VIndex_Compare] = (System_ObjectVector)&spaceT(System_ArrayXFunctorComparer,T,Compare); \
	) \
	Implement_CtorT(,System_ArrayXFunctorComparer,T, \
		Collections_Comparer(T) *c; \
		baseCtor(,t,System_Object); \
		c = getsT(Collections_Comparer,T,Default); \
		t->_c = c; \
		t->_comparison = comparison; \
	, System_Comparison(T) comparison)

#endif /* __System_ArrayXFunctorComparer_H__ */
